package chapter15;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/3/14 15:27
 */
interface HasColor{
    String getColor();
}

class Colored<T extends HasColor>{
    T item;
    Colored(T item){
        this.item = item;
    }

    T getItem(){
        return item;
    }

    String color(){
        return item.getColor();
    }
}

class Dimension{
    public int x,y,z;
}

class ColoredDimension<T extends Dimension & HasColor>{
    T item;

    public ColoredDimension(T item) {
        this.item = item;
    }

    T getItem(){
        return item;
    }

    String color(){
        return item.getColor();
    }

    int getX(){
        return item.x;
    }

    int getY(){
        return item.y;
    }

    int getZ(){
        return item.z;
    }
}

interface Weight{
    int weight();
}

class Solid<T extends Dimension & HasColor & Weight>{
    T item;

    public Solid(T item) {
        this.item = item;
    }

    T getItem(){
        return item;
    }

    String color(){
        return item.getColor();
    }

    int weight(){
        return item.weight();
    }

    int getY(){
        return item.y;
    }
}

class Bounded extends Dimension implements HasColor,Weight{

    @Override
    public String getColor() {
        return null;
    }

    @Override
    public int weight() {
        return 0;
    }
}

public class BasicBounds {
    public static void main(String[] args) {
        Solid<Bounded> solid = new Solid<>(new Bounded());
        solid.color();
        solid.getY();
        solid.weight();
    }
}
